import cv2
cap = cv2.VideoCapture(0)
while cap.isOpened():
    retval, frame = cap.read()
    if not retval:
        print('没有采集到')
        break
    cv2.imshow('videp', frame)
    key = cv2.waitKey(60)
    if key == ord(' '):
        break

cap.release()
cv2.destroyAllWindows()